<?php
class Admin_Controller_Base extends controller{
    public function init(){
        $this->assign('menu',$this->getMenu());
        parent::init();
    }

    protected function getMenu(){
        return array(
            array(
                'level'     => 1,
                'name'      => '项目管理',
                'has_url'   => 0,
            ),
            array(
                'level'     => 2,
                'name'      => '添加项目',
                'has_url'   => 1,
                'url'       => MONK::_url('project/CheckCategory')
            ),
            array(
                'level'     => 2,
                'name'      => '项目列表',
                'has_url'   => 1,
                'url'       => MONK::_url('project/list')
            ),
            array(
                'level'     => 1,
                'name'      => '资金管理',
                'has_url'   => 0,
            ),
            array(
                'level'     => 2,
                'name'      => '添加资金',
                'has_url'   => 1,
                'url'       => MONK::_url('bankroll/add')
            ),
            array(
                'level'     => 2,
                'name'      => '资金列表',
                'has_url'   => 1,
                'url'       => MONK::_url('bankroll/list')
            ),
            array(
                'level'     => 1,
                'name'      => '机构管理',
                'has_url'   => 0,
            ),
            array(
                'level'     => 2,
                'name'      => '添加机构',
                'has_url'   => 1,
                'url'       => MONK::_url('organization/add')
            ),
            array(
                'level'     => 2,
                'name'      => '机构列表',
                'has_url'   => 1,
                'url'       => MONK::_url('organization/list')
            ),
            array(
                'level'     => 1,
                'name'      => '消息管理',
                'has_url'   => 0,
            ),
            array(
                'level'     => 2,
                'name'      => '发送消息',
                'has_url'   => 1,
                'url'       => MONK::_url('message/add')
            ),
            array(
                'level'     => 2,
                'name'      => '消息列表',
                'has_url'   => 1,
                'url'       => MONK::_url('message/list')
            ),
            array(
                'level'     => 1,
                'name'      => '账户管理',
                'has_url'   => 1,
                'url'       => MONK::_url('account/list')
            ),
            array(
                'level'     => 2,
                'name'      => '添加账户',
                'has_url'   => 1,
                'url'       => MONK::_url('account/add')
            ),
            array(
                'level'     => 2,
                'name'      => '项目方管理',
                'has_url'   => 1,
                'url'       => MONK::_url('itemmaster/list')
            ),
            array(
                'level'     => 2,
                'name'      => '投资人管理',
                'has_url'   => 1,
                'url'       => MONK::_url('investor/list')
            ),
            array(
                'level'     => 2,
                'name'      => '金顾问管理',
                'has_url'   => 1,
                'url'       => MONK::_url('hand/list')
            ),
            array(
                'level'     => 1,
                'name'      => '管理员',
                'has_url'   => 0,
            ),
            array(
                'level'     => 2,
                'name'      => '添加管理员',
                'has_url'   => 1,
                'url'       => MONK::_url('admin/add')
            ),
            array(
                'level'     => 2,
                'name'      => '管理员列表',
                'has_url'   => 1,
                'url'       => MONK::_url('admin/list')
            ),
        );
    }
    
    protected function getDefaultPageLink($indexArr, $totalCount, $page = 1, $pageSize = 10){
        $pages = ceil($totalCount/$pageSize);
        $p_l = '';
        for($i=1;$i<=$pages;$i++){
            if($i == $page){
                $p_l .= '<span>'.$i.'</span>';
            }else{
                $p_l .= '<a href="'.MONK::_url('*/list', $indexArr).'">'.$i.'</a>';
            }
        }
        return $p_l;
    }
}
